﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="SchemaValidator"
    targetNamespace="urn:xmlbindings-shema"
    elementFormDefault="qualified"
    xmlns="urn:xmlbindings-shema"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="Bindings" type="bindingsXsType"/>

  <xs:complexType name="bindingsXsType">
    <xs:sequence>
      <xs:element name="Binding" type="bindingXsType" minOccurs="1" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="bindingXsType">
    <xs:sequence>
      <xs:element name="From" minOccurs="0" maxOccurs="1" type="fromXsType" />
      <xs:element name="Parameters" minOccurs="0" maxOccurs="1" type="parametersXsType"/>
      <xs:element name="Settings" minOccurs="0" maxOccurs="1" type="settingsXsType"/>
    </xs:sequence>
    <xs:attribute name="type">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="Type"/>
          <xs:enumeration value="Method"/>
          <xs:enumeration value="Const"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="to" use="required" type="xs:string"/>
    <xs:attribute name="scope" type="xs:string"/>
    <xs:attribute name="named" type="xs:string"/>
    <xs:attribute name="priority">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="Standard"/>
          <xs:enumeration value="Low"/>
          <xs:enumeration value="Normal"/>
          <xs:enumeration value="High"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="whenType">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="When"/>
          <xs:enumeration value="WhenInto"/>
          <xs:enumeration value="WhenIntoIsAssignable"/>
          <xs:enumeration value="WhenNamespaceEqual"/>
          <xs:enumeration value="WhenClassHasAttribute"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="whenValue" type="xs:string"/>
    <xs:attribute name="tryDisposeObjects" type="xs:boolean"/>
    <xs:attribute name="activator" type="xs:string"/>
    <xs:attribute name="constructorResolver" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="fromXsType">
    <xs:sequence>
      <xs:element name="Type" minOccurs="1" maxOccurs="unbounded" type="typeXsType"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="parametersXsType">
    <xs:sequence>
      <xs:element name="Parameter" minOccurs="0" maxOccurs="unbounded" type="parameterXsType"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="settingsXsType">
    <xs:sequence>
      <xs:element name="Setting" minOccurs="0" maxOccurs="unbounded" type="settingXsType"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="typeXsType">
    <xs:attribute name="value" type="xs:string" use="required"/>
  </xs:complexType>

  <xs:complexType name="parameterXsType">
    <xs:attribute name="type" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="Constructor"/>
          <xs:enumeration value="Method"/>
          <xs:enumeration value="Property"/>          
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="methodName" type="xs:string"/>
    <xs:attribute name="name" type="xs:string" use="required"/>
    <xs:attribute name="value" type="xs:string" use="required"/>
  </xs:complexType>

  <xs:complexType name="settingXsType">
    <xs:attribute name="key" type="xs:string" use="required"/>
    <xs:attribute name="value" type="xs:string" use="required"/>
  </xs:complexType>
</xs:schema>
